﻿@model List<EasyToHelp.Entity.TableManageFormList>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>表单维护</title>
    <link href="/layui/css/layui.css" rel="stylesheet" />
    <script src="/layui/layui.js"></script>
    <script src="/lib/jquery/dist/jquery.min.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
    <blockquote class="layui-elem-quote layui-text">
        <form class="layui-form" action="">
            <div class="layui-form-item">
                <label class="layui-form-label">表单code：</label>
                <div class="layui-input-inline">
                    <div class="layui-row">
                        <div class="layui-col-xs10">
                            <div class="grid-demo grid-demo-bg1">
                                <input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-col-xs2">
                            <div class="grid-demo">
                                <button class="layui-btn layui-btn-normal">搜索</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
        <div class="layui-row">
            <div class="layui-btn-group">
                <button onclick="Add()" class="layui-btn">
                    <i class="layui-icon">&#xe608;</i> 添加
                </button>
            </div>
        </div>
    </blockquote>
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>表单维护</legend>
    </fieldset>
    <table class="layui-table">
        <thead>
            <tr>
                <th>编号</th>
                <th>表单标题</th>
                <th>表单主表</th>
                <th>主键字段</th>
                <th>主键类型</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            @if (Model != null)
            {
                foreach (var item in Model)
                {
                    <tr>
                        <td>@item.Id</td>
                        <td>@item.title</td>
                        <td>@item.code</td>
                        <td>@item.pkName</td>
                        <td>@item.pkName</td>
                        <td>
                            <button onclick="Add()" class="layui-btn layui-btn-normal layui-btn-sm">新增</button>
                            <button onclick="Update('Id' ,@item.Id)" class="layui-btn layui-btn-warm layui-btn-sm"><i class="layui-icon"></i>编辑</button>
                            <button onclick="del('Id', @item.Id)" class="layui-btn layui-btn-danger layui-btn-sm">删除</button>
                            <button onclick="TableMS('@item.code')" class="layui-btn layui-btn-sm">表单管理</button>
                        </td>
                    </tr>
                }
            }
        </tbody>
    </table>
</body>
</html>
<script type="text/javascript">
    function Add() {
        layui.use('layer', function () {
            var layer = layui.layer;
            layer.open({
                type: 2,
                title: false,
                shadeClose: true,
                shade: 0.8,
                area: ['800px', '600px'],
                content: '/FormManage/FormView?TableName=TableManageFormList'
            });
        });
    }
    function Update(fkname, fkvalue) {
        layui.use('layer', function () {
            var layer = layui.layer;
            layer.open({
                type: 2,
                title: "表单维护",
                shadeClose: true,
                shade: 0.8,
                area: ['800px', '600px'],
                content: '/FormManage/FormView?TableName=TableManageFormList&FkName=' + fkname + '&FkValue=' + fkvalue + ''
            });
        });
    }
    function del(fkname) {
        layui.use('layer', function () {
            var layer = layui.layer;
            layer.confirm('数据珍贵，您确定要删除吗？', {
                btn: ['不后悔', '后悔了'] //按钮
            }, function () {
                layer.msg('删除成功', { icon: 1 });
            }, function () {
                layer.msg('取消删除', { icon: 1 });
            });
        });
    }
    function TableMS(tbname) {
        layui.use('layer', function () {
            var layer = layui.layer;
            layer.open({
                type: 2,
                title: "表单管理",
                shadeClose: true,
                maxmin: true,
                shade: 0.8,
                area: ['1100px', '600px'],
                content: '/FormManage/FormFieldManage?TableName=' + tbname
            });
        });
    }
</script>